<%= render :partial => 'shared/item_left_bar', :locals => { :on => 6 } -%>

<div id="main">
  <div class="box">
    <form class="border p10 th" action="/items" method="get">
      <label>编号：
        <input type="text" name="id" value="<%= params[:id] %>"/>
      </label>
      &nbsp;&nbsp;
      <br/>
      <label>名称：
        <input type="text" name="name" value="<%= params[:name] %>"/>
      </label>
      &nbsp;&nbsp;
      <br/>
      <label>状态：
        <%= select_tag :item_status, options_for_item_status(params[:item_status].to_i) -%>
      </label>
      &nbsp;&nbsp;
      <label>风格：
        <%= select_tag :style_id, options_for_item_style(params[:style_id].to_i) -%>
      </label>
      &nbsp;&nbsp;
      <label>品牌：
        <%= select_tag :brand_id, options_for_brand(params[:brand_id].to_i) -%>
      </label>
      &nbsp;&nbsp;
      <br/>
      <label>一级分类：
        <%= select_tag :cat1_id, options_for_cat1(params[:cat1_id].to_i) -%>
      </label>
      &nbsp;&nbsp;
      <label>二级分类：
        <%= select_tag :cat2_id, options_for_select(['二级分类']) -%>
      </label>
      &nbsp;&nbsp;
      <br/>
      <input class="submit btt90 bttb" type="submit" value="查询" />
      <input class="submit btt90 bttb" type="reset" value="重置" />
    </form>
  </div>

  <div class="box">
    <% form_for :items, :url => update_status_items_path, :html => { :method => :put, :id => 'update_status' } do |f| -%>
    <table width="96%" class="table border">
      <tr>
        <td height="35" colspan="11">
          <%= hidden_field_tag :status -%>
          <%= hidden_field_tag :flag -%>
          <a class="btt bttb update_status" rel="0">初始化</a>
          <a class="btt bttb update_status" rel="1">上架</a>
          <a class="btt bttb update_status" rel="-2">下架</a>
          <a class="btt bttb update_status" rel="-1">删除</a>
          <a class="btt bttb update_flag" rel="1">热门商品</a>
          <a class="btt bttb update_flag" rel="2">本周人气榜</a>
          <a class="btt bttb update_flag" rel="3">兜兜推荐</a>
          <a class="btt bttb update_flag" rel="4">热门点评</a>
          <a class="btt bttb update_flag" rel="5">最新点评</a>
        </td>
      </tr>
      <tr>
        <th width="15"><input type="checkbox" id="check_all"></th>
        <th width="60">操作</th>
        <th width="38">编号</th>
        <th width="90">状态/首页推荐</th>
        <th width="150">名称(点击直接修改)</th>
        <th width="80">分类</th>
        <th width="60">品牌</th>
        <th width="48">风格</th>
        <th width="48">季节</th>
        <th>描述</th>
        <th width="120">创建时间</th>
      </tr>
      <% for item in @items -%>
        <tr class="<%= cycle('', 'tr2') %>">
          <td><input type="checkbox" class="check" name="ids[]" value="<%= item.id %>"></td>
          <td>
            <%= link_to '编辑', edit_item_path(item) %>
            <%= link_to '评论', item_item_ratings_path(item) %>
            <a class="open_window item_recommend" rel="item" id="<%= item.id %>" name="<%= item.name %>">推荐</a>
          </td>
          <td><%= item.id %></td>
          <td><%= item.display_status %> <%= item.display_flag %></td>
          <td><div class="item_title" rel="<%= item.id %>" title="<%= item.name %>"><%= truncate item.name, :length => 16 %><div></td>
          <td><%= show_category_for(item) %></td>
          <td><%= item.brand %></td>
          <td><%= item.item_style %></td>
          <td><%=h item.season %></td>
          <td title="<%= item.description %>"><%=h truncate item.description, :length => 20 %></td>
          <td><%= item.created_at %></td>
        </tr>
      <% end -%>
    </table>
    <% end -%>
  </div>
  
  <%= will_paginate @items -%>
  
  <%= render :partial => 'pop_recommend' -%>
</div>

<%= javascript_include_tag 'base' -%>
